package com.example.test.service.impl;

import com.example.test.domain.Role;
import com.example.test.repository.IRoleRepository;
import com.example.test.service.IRoleService;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;

import java.util.Optional;

@Service
public class RoleServiceImpl extends BaseServiceImpl<Role, Long> implements IRoleService {
    public RoleServiceImpl(IRoleRepository repository) {
        super(repository);
    }

    @Override
    public Optional<Role> findByCode(String code) {
        Role example = new Role();
        example.setCode(code);
        return repository.findOne(Example.of(example));
    }
}
